package com.mytools.common.pattern.composite03;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LJK
 * @description
 * @date 2025/2/24
 */
public class Provice implements Count{

    final String name;
    List<City>cityList=new ArrayList<>();
    public Provice(String name) {
        this.name = name;
    }
    public void add(City city){
        this.cityList.add(city);
    }
    @Override
    public int getValue() {
        return cityList.stream().mapToInt(City::getValue).sum();
    }
}
